package com.hippoframework.bean;
import java.util.List;
import java.util.Objects;

import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

/**
 * 通用Bean定义模板
 *
 * @author TylerW
 * @date 1/15/2020 5:50 PM
 */
@Getter
@Setter
public class GenericBeanDefinition implements BeanDefinition {

    @NonNull
    private Class<?> beanClass;

    private String scope = BeanDefinition.SINGLETON;

    private String initMethodName;

    private boolean lazyInit = false;

    private String beanClassName;

    @NonNull
    private String beanName;

    /**
     * 依赖的其他Bean
     * <p>left:beanName, right:field
     */
    private List<DependencyDescriptor> dependsOn;

    /**
     * 是否优先注入
     */
    private boolean primary = false;

    /**
     * 是否抽象
     */
    private boolean abstractFlag = false;

    private FactoryBean<?> factoryBean;

    @Override
    public boolean isSingleton() {
        return Objects.equals(scope, BeanDefinition.SINGLETON);
    }

    @Override
    public boolean isPrototype() {
        return Objects.equals(scope, BeanDefinition.PROTOTYPE);
    }

    @Override
    public boolean isAbstract() {
        return abstractFlag;
    }



}
